package 多线程和队列.淺拷貝深拷貝;

/**
 * @author Amos  2022/12/4
 */
public class Student1 implements Cloneable{
    private String name;
    private int age;
    private Person1 person1;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }

    public Person1 getPerson1() {
        return person1;
    }

    public void setPerson1(Person1 person1) {
        this.person1 = person1;
    }

    @Override
    public String toString() {
        return "Student{" +
                this.hashCode()+
                "name='" + name + '\'' +
                ", age=" + age +
                ", person1=" + person1 +
                '}';
    }
    @Override
    protected Object clone(){
        try {
            Student1 student1 = (Student1)
                    super.clone();
            student1.person1 = (Person1)
                    person1.clone();
            return student1;
        } catch (CloneNotSupportedException
                e) {
            e.printStackTrace();
            return null;
        }
    }
}

